{include file='_header'}
<div class="page-header">
	当前位置：<span class="text-primary">文章管理 </span>
</div>
<div class="page-content">
<form action="" method="get" class="form-horizontal" role="form">
	<div class="page-toolbar m-b-sm m-t-sm">
		<div class="col-sm-4">
			<span class="">
				<a class='btn btn-primary btn-sm' href="{:url('admin/article/add')}"><i class="fa fa-plus"></i> 添加文章</a>
			</span>
		</div>
		<div class="col-sm-6 pull-right">
			<div class="input-group">
				<div class="input-group-select">
					<select name="category" class='form-control select2' style="width:150px;">
						<option value="" {if $_GET['category'] == ''} selected{/if}>分类</option>
						{foreach name='categorys' item='category'}
						<option value="{$category['id']}" {if $_GET['category']==$category['id']}selected="selected"{/if}>{$category['category_name']}</option>
						{/foreach}
					</select>
				</div>
				<input type="text" class=" form-control" name='keyword' value="{$_GET['keyword']}" placeholder="请输入关键词"> <span class="input-group-btn">
				<button class="btn btn-primary" type="submit"> 搜索</button> </span>
			</div>
		</div>
	</div>
</form>

<!-- 文章列表 -->
{if count($articles)>0}
	<div class="page-table-header">
		<input type="checkbox">
		<div class="btn-group ">
			<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/article/state',array('state'=>1))}">
				<i class='icow icow-qiyong'></i> 开启
			</button>
			<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/article/state',array('state'=>0))}">
				<i class='icow icow-jinyong'></i> 关闭
			</button>
			<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:url('admin/article/delete')}">
				<i class='icow icow-shanchu1'></i> 删除
			</button>
		</div>
	</div>
	<table class="table table-hover table-responsive">
		<thead>
			<tr>
				<th style="width:25px;"></th>
				<th style="width:44px;">排序</th>
				<th>文章标题</th>	
				<th>关键字</th>
				<th>创建时间</th>
				<th>阅读量</th>
				<th>点赞量</th>	
				<th style="width:100px;">状态</th>
				<th style="width: 150px;">操作</th>
			</tr>
		</thead>
		<tbody>	
			{foreach name='articles' item='article'}
			<tr>
				<td>
					<input type='checkbox' value="{$article['id']}" />
				</td>
				<td>
					<a href='javascript:;' data-toggle='ajaxEdit' data-href="{:url('admin/article/displayorder',array('id'=>$article['id']))}">{$article['displayorder']}</a> 
				</td>
				<td>
					{if !empty($article['category_name'])}
						<span class="text-primary">[{$article['category_name']}]</span><br/>
					{/if}
					<a href="{:url('admin/article/edit',array('aid'=>$article['id'], 'preview'=>1), true)}" target="_blank" data-toggle="tooltip" title="点击预览">{$article['article_title']}</a>
				</td>
				<td>{$article['article_keyword2']}</td>
				<td>{:date('Y-m-d', strtotime($article['article_date']))}<br/>{:date('H:i', strtotime($article['article_date']))}</td>
				<td data-toggle='tooltip' title='{$article['article_readnum']}'>{$article['article_readnum']}</td>
				<td data-toggle='tooltip' title='{$article['article_likenum']}'>{$article['article_likenum']}</td>	
				<td>
					<span class='label 
						{if $article['article_state']==1}label-primary{else}label-default{/if}' 
							data-toggle="ajaxSwitch" 
							data-confirm = "确认{if $article['article_state']==1}关闭{else}开启{/if}吗？"
							data-switch-value="{$article[" article_state "]}" 
							data-switch-value0="0|关闭|label label-default|{:url('admin/article/state',array('state'=>1,'id'=>$article['id']))}" 
							data-switch-value1="1|开启|label label-primary|{:url('admin/article/state',array('state'=>0,'id'=>$article['id']))}" 
						>						
						{if $article['article_state']==1}开启{else}关闭{/if}
					</span>	
				</td>
				<td>
					<a href="javascript:;" data-url="{$article['url']}" class="js-clip btn btn-default btn-sm btn-op btn-operation">
						<span data-toggle="tooltip" data-placement="top"  data-original-title="复制链接">
                           <i class='icow icow-lianjie2'></i>
                       </span>
					</a>
					<a class='btn btn-default btn-sm btn-op btn-operation' href="{:url('admin/article/edit',array('aid'=>$article['id']))}">
						<span data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑">
                         <i class="icow icow-bianji2"></i>
                     </span>
					</a>
					<a data-toggle="ajaxRemove" class='btn btn-default btn-sm btn-op btn-operation' href="{:url('admin/article/delete',array('id'=>$article['id']))}" data-confirm="确认要删除此文章?">
						<span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
                            <i class='icow icow-shanchu1'></i>
                       </span>
					</a>
				</td>
			</tr>
			{/foreach}
		</tbody>
		<tfoot>
			<tr>
				<td>
					<input type="checkbox">
				</td>
				<td colspan="3">
					<div class="btn-group ">
						<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/article/state',array('state'=>1))}">
							<i class='icow icow-qiyong'></i> 开启
						</button>
						<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/article/state',array('state'=>0))}">
							<i class='icow icow-jinyong'></i> 关闭
						</button>
						<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:url('admin/article/delete')}">
							<i class='icow icow-shanchu1'></i> 删除
						</button>
					</div>
				</td>
				<td colspan="5" class="text-right">	{$pager} </td>
			</tr>
		</tfoot>
	</table>
{else}
	<div class='panel panel-default'>
		<div class='panel-body' style='text-align: center;padding:30px;'>
			暂时没有任何文章!
		</div>
	</div>
{/if}
</form>
</div>
{include file='_footer'}